#pragma once
#include "stdafx.h"
#include "node.h"
#include "..//NilKey.h"
#include "..//VectorKey.h"
class CGlobalOperator :
	public CNode
{
public:
	CGlobalOperator(const NODE_INDEX nNodeIndex);
	virtual ~CGlobalOperator(void);
	virtual void OnTimer(const TIMER_TYPE dwType);
	virtual void OnJoin(void);
	virtual void OnLeave(void);
	void OnInsertData(void);
	void OnSearchNode(void);
	void OnSearchData(void);
	void OnSnapShot(void);
	void OnSearchDataMultipRange(void);
private:
	vector<KEY> m_cDataImage;
	vector<pair<KEY,int>> m_cSeedImage;
	vector<pair<KEY,vector<int>>> m_cRangeSeedImage;
	int m_nDataPublishCount;
	ofstream fout_data;
	ofstream fout_budget;
	ofstream fout_in_degree;
	ofstream fout_node_search;
	ofstream fout_data_search;
	ofstream fout_size;
	ofstream fout_drange;
	ofstream fout_visit_ratio;
	ofstream fout_data_ratio;
	ofstream fout_visit_ratio_drange;
	ofstream fout_data_ratio_drange;
	int FindKeyGlobal(const KEY & cDest, const int nMaxDis);
};
